package com.fowo.api.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fowo.api.sys.entity.SysUser;
import com.fowo.api.sys.model.SysAllAuthorityItem;
import com.fowo.api.sys.model.SysUserItemVo;
import com.fowo.api.sys.model.SysUserSearch;
import com.fowo.api.user.model.CurrentUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    CurrentUser selectCurrentUserById(@Param("id") Long id);

    List<SysAllAuthorityItem> selectAllAuthorityByUserId(@Param("id") Long id, @Param("appId") Long appId);

    Page<SysUserItemVo> searchPage(Page page, @Param("search") SysUserSearch search);

    List<SysUserItemVo> search(@Param("search") SysUserSearch search);

    String getNameOrUsernameByUserId(@Param("userId") Long userId);

    String getNameById(@Param("userId") Long userId);

    /**
     * 获取满足参数条件的用户编号列表
     * @param deptIdList (可空)所属部门编号列表
     * @param deptCodeList (可空)所属部门代码列表
     * @param deepDeptIdList (可空)所属上级部门编号列表（匹配全部下属部门）
     * @param deepDeptCodeList (可空)所属上级部门代码列表（匹配全部下属部门）
     * @param roleIdList (可空)所属角色编号列表
     * @param menuIdList (可空)可用菜单编号列表
     * @return
     */
    List<Long> selectUserIdListBy(
        @Param("deptIdList")
        List<Long> deptIdList, 
        @Param("deptCodeList")
        List<String> deptCodeList, 
        @Param("deepDeptIdList")
        List<Long> deepDeptIdList, 
        @Param("deepDeptCodeList")
        List<String> deepDeptCodeList, 
        @Param("roleIdList")
        List<Long> roleIdList,
        @Param("menuIdList")
        List<Long> menuIdList
        );
}
